package cubelabs.nexus.dao;

import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;

import cubelabs.nexus.entity.OpenTokSession;

@Repository("openTokSessionDAO")
public class OpenTokSessionDAO extends BaseDAO<OpenTokSession, Long>{

	public OpenTokSession findByEventId(Long eventId){
		Criteria crit = getSession().createCriteria(getPersistentClass());
		crit.add(Restrictions.eq("eventId", eventId));
		OpenTokSession openTokSession  = (OpenTokSession) crit.uniqueResult();
		return openTokSession;
	}
}
